<%@ page language="java" import="java.util.*,java.text.SimpleDateFormat,cn.bupt.adt.constant.Constants" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page  isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	//分页
	//currentPage就是当前页，allPages表示的就是一共有多少页。这些在后面都会用到  
	int currentPage = 0, allPages = 0;
	if (request.getAttribute("currentPage") != null) {
		currentPage = Integer.parseInt(request.getAttribute(
				"currentPage").toString());
	}
	if (request.getAttribute("allPages") != null) {
		allPages = Integer.parseInt(request.getAttribute("allPages")
				.toString());
	}
	//本页面url，翻页用
	String url = "doctorManagement/unreviewIndex";
	request.setAttribute("url", url);
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
	String year = sdf.format(new Date());
	request.setAttribute("nowyear", year);
%>
<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    

	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/bootstrap.min.css" />

    <link href="<%=request.getContextPath()%>/assets/css/font-awesome.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
	<script src="<%=request.getContextPath()%>/assets/js/jquery-1.10.2.js" type="text/javascript"></script>
	<script  type="text/javascript" src="js/layer/layer.js" ></script>
	<script src="assets/js/bootstrap.js"></script>
	<link rel="stylesheet" href="layerui/css/layui.css"><link>
	 <link rel="stylesheet" href="css/Orderfont.css"><link>
	<script type="text/javascript" src="layerui/layui.js"></script>
	<script type="text/javascript" src="js/public/buttonModal.js"></script>
	<script type="text/javascript" src="js/public/submitForm.js"></script>
	  </head>
  <c:if test="${!empty oper_message }">
  	<script type="text/javascript">
  		alert("${oper_message}");
  	</script>
  </c:if>
<!-- 	<script type="text/javascript">
	layer.msg('Hello layer');
	</script> -->
  <body>
		  <div class="page-header">
		  		<h1><small>待审核医生列表<i class="icon-double-angle-right"></i></small></h1>
			</div>
  	<div class="container">
	<div class="table-responsive">
		<form action="doctorManagement/unreviewIndex/1" class="form-inline">
		<div class="form-group">
			<select name="searchMethod" class="form-control" >
				<option value="true" <c:if test="${searchMethod == true}">selected="selected"</c:if> >姓名搜索</option>
				<option value="false" <c:if test="${searchMethod == false}">selected="selected"</c:if>>电话搜索</option>
			</select>		
		</div>
		<div class="form-group">
			<input type="text" class="form-control" name="content" value="${content }">
		</div>
		<div class="form-group">
			<input type="submit" class="btn btn-primary" value="搜索">
		</div>	         
		</form>
		<table class="table table-striped table-hover ">
			<thead >
				<tr class="center">
					<th>姓名</th>
					<th>电话</th>
					<th>年龄</th>
					<th>职称</th>
					<th>身份证号码</th>
					<th>接单数</th>
					<th>完成单数</th>
					<th>医生标签</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody >
			<c:forEach items="${doctors}" var="item" varStatus="idx">
				<tr class="center">
					<td><span>${item.name}</span></td>
					<td><span>${item.phone}</span></td>
					<td><span><%-- ${nowyear - fn:substring(item.identificationNumber,6,10)} --%>${item.age}</span> </td>
					<td><span>${item.professionalTitle}</span></td>
					<td><span>${item.identificationNumber}</span></td>
					<td><span>${item.takeOrderNum}</span></td>
					<td><span>${item.finishOrderNum}</span></td>
					<td><span>${item.labels}</span></td>
					<td>
						<div>
						<c:choose>
							<c:when test="${item.reviewStatus == false}">
								<a title="审核"  href="doctorManagement/reviewDoctorDetail/${item.id}">
									<i class="layui-icon"  >&#xe642;</i>
								</a>
							</c:when>
							<c:otherwise>
								<a title="查看"  href="doctorManagement/lookupdetail/${item.id}">
									<i class="layui-icon"  >&#xe642;</i>
								</a>							
							</c:otherwise>
						</c:choose>

							<a title="删除医生" href="doctorManagement/deleteDoctor/${item.id }" onclick="return confirm('该删除操作仅仅用于删除您刚刚因手误而增加的医生，请确保该医生应该还未注册及充值，删除正常账号将会带来麻烦，您还要删除吗？'); ">
								<i class="layui-icon">&#xe640;</i>
							</a>							
						</div>
					</td>
				</tr>	
			</c:forEach>

			</tbody>
			<tfoot>
				<tr>
					<td colspan="10" style="text-align:left">
			     	<c:if test="${allPages>1}">
			     	<ul class="pagination">
			     		<li ><a href="${url}/1">首页</a></li>
			     		<li><a href="javascript:void(0)" id="previous" onclick="dividePage('${url}','previous')">&laquo;</a></li>
			     		<c:forEach var="item" begin="1" end="${allPages }" varStatus="idx">
						  	<c:choose>
						  		<c:when test="${idx.index == currentPage }">
						  			<li class="active"><a href="javascript:void(0)" id="active">${idx.index}</a></li>
						  		</c:when>
						  		<c:otherwise>
						  			<li><a href="${url}/${idx.index}">${idx.index}</a></li>
						  		</c:otherwise>
						  	</c:choose>
						  </c:forEach>
					      <li><a href="javascript:void(0)" id="next" onclick="dividePage('${url}','next','${allPages}')">&raquo;</a></li>
			     			<li ><a href="${url}/${allPages}">尾页</a></li>
					</ul>			     	
			     	</c:if>
			     	
					
					</td>
				</tr>
				<tr>
					<td><button class="btn btn-primary" onclick="$('#myModal').modal('toggle');" id="tianjia">添加医生</button></td>
				</tr>
			</tfoot>
		</table>
	      <div id="myModal" class="modal fade">
	      		<div class="modal-dialog">
	      			<div class="modal-content">
	      				<div class="modal-header">
	      					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	      					<h4 class="modal-title">请输入医生电话</h4>
	      				</div>
	      				<div class="modal-body">
	      					<form action="doctorManagement/addDoctor" method="post" id="form">
	      						<input type="text" name="phone" id="phoneId" class="form-control" placeholder="请输入医生电话">
	      					</form>
	      				</div>
	      				<div class="modal-footer">
	      					<button type="button" class="btn btn-primary" id="sub">确认</button>
	      					<button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
	      				</div>
	      			</div>
	      		</div>
	      </div>   	      	
	</div>
	</div>
	<script type="text/javascript" src="js/public/dividePage.js"></script>
	<script type="text/javascript">
	<%--	submitFormByButton("sub${idx.index}","form${idx.index}","modifyPhone${idx.index}"); --%>
	submitFormByButton("sub","form","phoneId");
	</script>
	


  </body>
</html>